import $ from '@/utils/requset'
// 登录
const postLogin = ({ account, password } = {}) =>
  $.postAxios('/login', { account, password })
// 首页
const getHome = () => $.getAxios('/home/category/head')
//二级菜单
const twoMenu = id => $.getAxios('/category/sub/filter', id)
// 二级菜单列表数据 
const menuLisApi = ({page=null,pageSize=null}) => $.postAxios('/category/goods/temporary',{page,pageSize})

// 购物车列表
const getShopp = () => $.getAxios('/member/cart')

// 修改购物车商品
const setShopp= (id,obj) => $.putAxios(`/member/cart/${id}`,obj)

//获取购物车数量
const getShoppNum= () => $.getAxios('/member/cart/count')

//详情
const getParti = ({ id = null }) => $.getAxios('/goods', { id })

// 获取订单
const getOrder = (data = {}) => $.getAxios("/member/order", data)

//加入购物车 /member/cart
const postCart = (data) => $.postAxios('/member/cart',{skuId:data.skuId,count:data.count})

//删除购物车单个商品
const deleteCart=(data) => $.deleteAxios('/member/cart',data)

    //轮播图
const bannerImg = () => $.getAxios("/home/banner")

//全部分类
const CategoryList = () => $.getAxios("/home/category/head")

//新鲜好物
const NewThing = () => $.getAxios("/home/new")

//人气推荐
const HotList = () => $.getAxios("/home/hot")

//商品楼层区块
const ProductList = () => $.getAxios("/home/goods")

//最新专题
const Special = () => $.getAxios("/home/special");

//热门品牌
const ReBrand = () => $.getAxios("/home/brand");

export default {
  //登录
  postLogin,
  getHome,
  // 二级菜单筛选数据
  // getCate,
  // 二级菜单列表
  menuLisApi,
  twoMenu,

  getShopp,
  //    详情
  getParti,

  // 订单
  getOrder,

//  加入购物车
  postCart,

  //轮播图
  bannerImg,
  //全部分类
  CategoryList,
  //新鲜好物
  NewThing,
  //人气推荐
  HotList,
  //商品楼层区块
  ProductList,
  //最新专题
  Special,
  //热门品牌
  ReBrand,
  setShopp,
  getShoppNum,
  //购物车删除
  deleteCart
}
